# $Id: PKGBUILD 180514 2013-03-22 13:00:52Z andrea $
# Maintainer:
# Contributor: Andrea Scarpino <andrea@archlinux.org>
# Contributor: Tobias Powalowski <tpowa@archlinux.org>

pkgname=cfitsio
pkgver=3.340
pkgrel=1
pkgdesc="A library of C and Fortran subroutines for reading and writing data files in FITS (Flexible Image Transport System) data format"
arch=('i686' 'x86_64')
url="http://heasarc.gsfc.nasa.gov/docs/software/fitsio/fitsio.html"
license=('custom')
depends=('glibc')
options=('!libtool')
source=("ftp://heasarc.gsfc.nasa.gov/software/fitsio/c/${pkgname}${pkgver/./}.tar.gz")
md5sums=('99210838af46b7bf2d945ccbb05e3ad3')

build() {
  cd ${pkgname}
  ./configure --prefix=/usr
  make shared
}

check() {
  cd ${pkgname}
  make testprog
  LD_LIBRARY_PATH=. ./testprog > testprog.lis
  [[ -z $(diff testprog.lis testprog.out) ]] || return 1
  [[ -z $(cmp testprog.fit testprog.std) ]] || return 1
}

package() {
  cd ${pkgname}
  make DESTDIR="${pkgdir}" install
  install -D -m644 License.txt \
    "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE
}
